home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
program
/
n_b_v203.zip
/
HELPLINE.DMO
< prev
next >
Wrap
Text File
|
1996-07-04
|
6KB
|
94 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-10-01 ╟─╖
│ │ FILE NAME HELPLINE.DMO ║ by ╘════════════════─ ║ ║
│ │ ║ Don Schullian, Jr. ║ ║
│ ╘══════════════════════════╝ ║ ║
│ A license is hereby granted to the holder to use this source code in ║ ║
│ any program, commercial or otherwise, without receiving the express ║ ║
│ permission of the copyright holder and without paying any royalties, ║ ║
│ as long as this code is not distributed in any compilable format. ║ ║
│ IE: source code files, PowerBASIC Unit files, and printed listings ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ .................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
$endif
'.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
$STACK 2048
$INCLUDE "DAS-NB01.INC"
$INCLUDE "DAS-NBT1.INC"
%ESC_key = 27
COLOR 0, 7, 7
CLS
? "┌────────────────────────────────────────────────────────────────────────
? "│ HelpLineSetup ( Row?, Col?, Cols?, Attr? )
? "│ fHelpLine$ ( Msg$, Justify% )
? "├────────────────────────────────────────────────────────────────────────
? "│ Menu items, by definition, must be short and, in most cases, graphic in
? "│ their meaning. A simple sentence will, usually, make the meaning clear
? "│ and remove any need to create a whole raft of pop-up help screens.
? "│ The same goes for input field prompts and other such items.
? "│ In a small program a single call to HelpLineSetup is usually sufficient
? "│ as the screen area would never change.
? "│ fHelpLine$ returns the message area in case it needs to be saved. If
? "│ Msg$ is NULL then the area is cleared.
? "│ Justify% = 1 for centering the message
? "│ Justify% = 2 for right justify
? "│ ELSE Msg$ is printed as found
? "└────────────────────────────────────────────────────────────────────────
'┌──────────────────
ON TIMER (1) GOSUB CLOCK '│ clock ready
MakeTBox 24, 1, 1, 10, 32, 31, 51, 120, 2, TIME$ '│ gettin' fancy
MakeTBox 24, 68, 1, 12, 32, 31, 51, 120, 2, DATE$ '│
MakeTBox 24, 14, 1, 52, 32, 47, 51, 120, 0, "" '│ prepare message
HelpLineSetup 24, 14, 52, 47 '│ line & call setup
'│
DIM M$(5) '│ our 5 messages
M$(0) = "Press 1 -> 4 to see all the messages" '│
M$(1) = "This is message 1, it is centered." '│
M$(2) = "This is message 2, it is right-justified." '│
M$(3) = "This is message 3, it has no justification." '│
M$(4) = "Press <»ESC/> to exit this demo." '│
M$(5) = " Do you wish to quit? [«Y ]es [/N ]o" '│ bail-out Y/N
'│
M% = 0 : J% = 1 '│
DO '│
fHelpLine M$(M%), J% '│ pop the message
G% = fGetKey% '│ get a key-press
IF G% = %ESC_key THEN '│ <ESC> pressed
H$ = fHelpLine$( M$(5), 1 ) '│ save message area
G% = fGetKey% '│ get another key
IF (G% <> 78) AND (G% <> 110) THEN EXIT LOOP '│ auto-out if not N
TBoxWrite H$ '│ restore old msg
ITERATE '│ loop around
END IF '│
SELECT CASE G% '│ set justification
CASE 50 : J% = 2 '│ "2"
CASE 51 : J% = 0 '│ "3"
CASE ELSE : J% = 1 '│ anything else
END SELECT '│
LOOP '│ <ESC> exits loop
'│
COLOR 7, 0, 0 '│
CLS '│
END '│ end program
'────────────────────────────────────────────────────────┼───────────────────
'│
CLOCK: '│ print time
Tprint 24, 2, TIME$, 0 '│
RETURN '│
'│
FUNCTION fGetKey% LOCAL PUBLIC '│ await key-press
'│
ClearKeyboard '│
TIMER ON '│ clock on here
WHILE NOT INSTAT : WEND '│ nothing happening
TIMER OFF '│ clock off here
FUNCTION = CVI( INKEY$ + CHR$(0) ) '│ RETURN key-press
'│
END FUNCTION '└───────────────────